#pragma once

#include "BasicFunction.h"
#include "DisplayText.h"
#include "ImageData.h"

// CImageRetrieval dialog

class CImageRetrieval : public CDialog
{
	DECLARE_DYNAMIC(CImageRetrieval)
private:
	using CDialog::Create;

public:
	CImageRetrieval(CWnd* pParent);   // standard constructor
	BOOL Create();
	virtual ~CImageRetrieval();

// Dialog Data
	enum { IDD = IDD_IMAGERETRIEVAL };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void PostNcDestroy();
	virtual void OnOK();
	afx_msg void OnClose();

	DECLARE_MESSAGE_MAP()

protected:
	CWnd*	m_Parent;
	int		m_nID;

public:
	//initialize the retrieval dialog
	void	InitializeRetrieval(void);

private:
	//define a database manipulation class
	CImageData m_ImageIndex;
	CImageData m_ImageData;
	//basic function
	CBasicFunction bf;
	//indicator of showtext
	bool	Is_TextShow;
public:
	afx_msg void OnBnClickedClearresults();
	afx_msg void OnBnClickedRetrieve();
//validate the first, second, and the third query of the dataset
	bool	OnValidateFirst(void);
	bool	OnValidateSecond(void);
	bool	OnValidateThird(void);
	afx_msg void OnLbnSelchangeImagelist();
private:
	// //Number of images retrieved from the database
	int		m_RetrievalNum;
	void	UpdateRetrievalNum(void);

private:
	CDisplayText* m_DisplayText;
public:
	afx_msg void OnBnClickedShowtext();
private:
	//get the order from the first selection
	CString OnGetFirstOrder(void);
	//get the order from the second selection
	CString OnGetSecondOrder(void);
	//get the order from the third selection
	CString OnGetThirdOrder(void);
};
